<!DOCTYPE html>
<style>
  ::first-line { color: red }
  .green { color: green }
</style>
<div class="green">
  <span>This text should be green</span>
</div>
<script>
  if (window.testRunner)
    testRunner.waitUntilDone();

  requestAnimationFrame(() =>
    requestAnimationFrame(() => {
      document.querySelector("span").className = "green";
      if (window.testRunner)
        testRunner.notifyDone();
    }));
</script>
